package com.gradle.quartz.batch.processor;

import com.gradle.bean.user.User;
import org.springframework.batch.item.ItemProcessor;
import org.springframework.stereotype.Component;

/**
 * 自定义加工处理器：比如数据清洗等操作
 *
 * @author ldanniel
 */
@Component
public class CustomizeItemProcessor implements ItemProcessor<User, User> {

    @Override
    public User process(User item) throws Exception {
        //将id为偶数的数据读取，其他放弃
        return item.getId() % 2 == 0 ? item : null;
    }
}
